<?php
$headermsg = '\"HTTP/1.0 '.$code[0].' '.$code[1].'\"';
header($headermsg);
$commentcount = 0;

echo "{\"comments\":[";
foreach($comments as $comment){
	if ($commentcount != 0){
		echo ",";
	}
	$commentcount = 1;
	echo "{\"comment\":{";
	echo "\"id\":\"".$comment['Comment']['id']."\",";
	echo "\"photo_id\":\"".$comment['Comment']['photo_id']."\",";
	echo "\"user_id\":\"".$comment['Comment']['user_id']."\",";
	echo "\"created\":\"".$comment['Comment']['created']."\",";
	echo "\"title\":\"".$comment['Comment']['title']."\",";
	echo "\"comment_text\":\"".$comment['Comment']['comment_text']."\"}";
	echo "}";
	}
echo "]}";
?>